{include file="header.html"}
<style>
.infoTable label {
  display: block;
  height: 25px;
  line-height: 25px;
  margin-left: 5px;
  color: #444;
}
</style>
<script type="text/javascript">
$(function(){
    //货主
    $("#unit_ower_img").live('click',function(){
        var id=$(this).attr("item");
        $w=$(window).width();
        $h=$(window).height();
        $w=$w*0.7;
        $("#hzframe").attr("src","index.php?app=waybill&act=choosehz");
        $("#hzframe").width($w);
        $.colorbox({
            width : $w+20,
            height : "650px",
            inline : true,
            href : "#hzlist"
        });
    });
    //承运商
    $("#unit_carrier_img").click(function(){
        $w=$(window).width();
        $h=$(window).height();
        $w=$w*0.7;
        $("#opframe").attr("src","index.php?app=waybill&act=chooseop");
        $("#opframe").width($w);
        $.colorbox({
            width : $w+20,
            height : "650px",
            inline : true,
            href : "#oplist"
        });
    });
    checktel();
    $('#user_form').validate({
        errorPlacement: function(error, element){
            $(element).next('.field_notice').hide();
            //$(element).after(error);
        },
        success       : function(label){
            label.addClass('right').text('OK!');
        },
        onkeyup    : false,
        rules : {
            user_name : {
                required : true,
                byteRange: [3,15,'{$charset}'],
                remote   : {
                    url :'index.php?app=user&act=check_user',
                    type:'get',
                    data:{
                        user_name : function(){
                            return $('#user_name').val();
                        },
                        id : '{$user.user_id}'
                    }
                }
            },
            password: {
                <!--{if $smarty.get.act eq 'add'}-->
                required : true,
                <!--{/if}-->
                maxlength: 20,
                minlength: 6
            },
            email   : {
                email : true
            },
            owner : {
                required : true
            }
        },
        messages : {
            user_name : {
                required : '{$lang.user_not_empty}',
                byteRange: '{$lang.user_length_limit}',
                remote   : '{$lang.name_exist}'
            },
            password : {
                <!--{if $smarty.get.act eq 'add'}-->
                required : '{$lang.password_empty}',
                <!--{/if}-->
                maxlength: '{$lang.password_limit}',
                minlength: '{$lang.password_limit}'
            },
            email  : {
                email   : '{$lang.currect_email}'
            },
            owner : {
                required : "{if $user_type==2} '货主必填'{else}'承运商必填'{/if}"
            }

        }
    });

});

//货主新弹框
function changehz(id,name,hzid,linkman,linktel){
    $('hzframe').colorbox.close();
    $("#unit_ower").val(id);
    $("#unit_ower_name").val(name);
}
function changeop(id,name,tel){
    $('opframe').colorbox.close();
    $("#unit_carrier").val(id);
    $("#unit_carrier_name").val(name);
}
function  checktel(){ 
	 $("#phone_tel").blur(function(){		 
		 var sMobile = document.user_form.phone_tel.value 			 
		 var telReg = !!sMobile.match(/^(0|86|17951)?(13[0-9]|15[012356789]|17[0-9]|18[0-9]|14[57])[0-9]{8}$/);
		 if(telReg == false){
                $(this).addClass("error");
		        document.user_form.phone_tel.focus(); 
		        return false; 
		    }
     });
}
</script>
<div id="rightTop">
  <p>{$lang.user}</p>
  <ul class="subnav">
    <li><a class="btn1" href="index.php?app=user">{$lang.manage}</a></li>
    <li>
      <!-- {if $user.user_id} -->
        <span>{$lang.edit}</span>
      <!-- {else} -->
        <span>{$lang.add}</span>
      <!-- {/if} -->
    </li>
  </ul>
</div>
<div class="info">
  <form method="post" enctype="multipart/form-data" id="user_form" name="user_form">
    <table class="infoTable">
      <tr>
          <input class="infoTableInput2" name="type" type="hidden" value="{$user.type}" />
        <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b> {$lang.user_name}:</th>
        <td class="paddingT15 wordSpacing5">
            <!-- {if $user.user_id} -->
            {$user.user_name|escape}
            <!-- {else} -->
            <input class="infoTableInput2" id="user_name" placeholder="3-25位,必填" type="text" name="user_name" value="{$user.user_name|escape}" />
            <!-- {/if} -->
        </td>
      </tr>
      <tr>
        <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>{$lang.password}:</th>
        <td class="paddingT15 wordSpacing5">
            <input class="infoTableInput2" name="password" type="text" id="password" value=""/>
            <!-- {if $user.user_id} -->
            <span class="grey">{$lang.note_password}</span>
            <!-- {/if} -->
        </td>
      </tr>
       <tr>
            <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>手机:</th>
            <td class="paddingT15 wordSpacing5">
                <input class="infoTableInput2" name="phone_tel" type="text" id="phone_tel" value="{$user.phone_tel|escape}" />
            </td>
      </tr>

      <tr>
        <th class="paddingT15">{$lang.email}:</th>
        <td class="paddingT15 wordSpacing5"><input class="infoTableInput2" name="email" type="text" id="email" value="{$user.email|escape}" />
            </td>
      </tr>
        <tr>
            <th class="paddingT15"><b style="color: #ff0000"></b>等级:</th>
            <td class="paddingT15 wordSpacing5">
                <select name="grade">
                    {html_options options=$grades selected=$user.grade}
                </select>
            </td>
        </tr>
      <tr>
        <th class="paddingT15"> {$lang.gender}:</th>
        <td class="paddingT15 wordSpacing5"><p>
            <label>
            <input name="gender" type="radio" value="0" {if $user.gender == 0}checked="checked"{/if} />
            {$lang.unknown}</label>
            <label>
            <input type="radio" name="gender" value="1" {if $user.gender == 1}checked="checked"{/if} />
            {$lang.male}</label>
            <label>
            <input type="radio" name="gender" value="2" {if $user.gender == 2}checked="checked"{/if} />
            {$lang.female}</label>
          </p>
        </td>
      </tr>
        {if $utype==2 || ($utype==-1 && $type==2)}
            <tr>
                <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>货主 :</th>
                <td class="paddingT15 wordSpacing5">
                    <input type="hidden" value="{$user.unit}" name="unit" id="unit_ower">
                    <input type="text"  placeholder="货主必填" value="{$user.o_name}" name="owner" id="unit_ower_name" class="infoTableInput2" >
                    <a href="javascript:void(0);" style="position: absolute;left: 290px;top: 2px;" id="unit_ower_img"><img src="templates/images/newadmin/serch.png" alt=""></a>
                </td>
            </tr>
        {elseif $utype==4 || ($utype==-1 && $type==4)}
            <tr>
                <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>承运商:</th>
                <td class="paddingT15 wordSpacing5">
                    <input type="hidden" value="{$user.unit}" name="unit" id="unit_carrier">
                    <input type="text"  placeholder="承运商必填" value="{$user.o_name}" name="owner" id="unit_carrier_name" class="infoTableInput2" >
                    <a href="javascript:void(0);" style="position: absolute;left: 290px;top: 2px;" id="unit_carrier_img" ><img src="templates/images/newadmin/serch.png" alt=""></a>
                </td>
            </tr>
        {/if}
        {if $utype==-1 && ($type==2 || $type==4)}
            <tr>
                <th class="paddingT15">查看组信息 :</th>
                <td class="paddingT15 wordSpacing5">
                    <label>
                        <input name="giveauth" type="radio" value="0" {if $user.giveauth == 0}checked="checked"{/if} />
                        否</label>
                    <label>
                        <input name="giveauth" type="radio" value="1" {if $user.giveauth == 1}checked="checked"{/if} />
                        是</label>
                </td>
            </tr>
        {/if}
      <!--<tr>
        <th class="paddingT15"> <label for="phone_tel">{$lang.phone_tel}:</label></th>
        <td class="paddingT15 wordSpacing5"><input name="phone_tel[]" id="phone_tel" type="text" size="4" value="{$phone_tel.0}" />
          -
          <input class="infoTableInput2" name="phone_tel[]" type="text" value="{$phone_tel.1}" />
          -
          <input name="phone_tel[]" type="text" size="4" value="{$phone_tel.2}" />
        </td>
      </tr>
      <tr>
        <th class="paddingT15"> {$lang.phone_mob}:</th>
        <td class="paddingT15 wordSpacing5"><input class="infoTableInput2" name="phone_mob" type="text" id="phone_mob" value="{$user.phone_mob|escape}" />
        </td>
      </tr>
      <tr>
        <th class="paddingT15"> {$lang.im_qq}:</th>
        <td class="paddingT15 wordSpacing5"><input class="infoTableInput2" name="im_qq" type="text" id="im_qq" value="{$user.im_qq|escape}" />        </td>
      </tr>
      <tr>
        <th class="paddingT15"> {$lang.im_msn}:</th>
        <td class="paddingT15 wordSpacing5"><input class="infoTableInput2" name="im_msn" type="text" id="im_msn" value="{$user.im_msn|escape}" />        </td>
      </tr>

     {if !$set_avatar}
      <tr>
        <th class="paddingT15">{$lang.portrait}:</th>
        <td class="paddingT15 wordSpacing5"><input class="infoTableFile2" type="file" name="portrait" id="portrait" />
          
          {if $user.portrait}<br /><img src="../{$user.portrait}" alt="" width="100" height="100" />{/if}           </td>
      </tr>
     {else}
        {if $smarty.get.act eq 'edit'}
      <tr>
        <th class="paddingT15">{$lang.portrait}:</th>
        <td class="paddingT15 wordSpacing5">{$set_avatar}</td>
      </tr>
        {/if}
     {/if}-->
      <tr>
        <th></th>
        <td class="ptb20"><input class="formbtn" type="submit" name="Submit" value="{$lang.submit}" />
          <input class="formbtn" type="reset" name="Reset" value="{$lang.reset}" />        </td>
      </tr>
    </table>
  </form>
</div>
<div style="display: none"  >
    <div id="hzlist">
        <iframe id="hzframe" width="" height="600px" frameborder="0" scrolling="no"></iframe>
    </div>
</div>
<div style="display: none"  >
    <div id="oplist">
        <iframe id="opframe" width="" height="600px" frameborder="0" scrolling="no"></iframe>
    </div>
</div>
{include file="footer.html"}